package com.wu.Backstage.service;

import com.wu.Backstage.entity.Po.CommodityEntityPo;
import com.wu.Backstage.entity.Po.OrderDetailsPo;
import com.wu.Backstage.entity.orderDateEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class OrderDetailsService {

    @Resource
    private orderDateEntity orderDateEntity;




    public int confirmReceipt(Integer id)
    {
        int stores = orderDateEntity.confirmReceipt(id);
        return stores;
    }

    /**商品添加**/
    public OrderDetailsPo AddOrderDetailsPo(OrderDetailsPo orderDeta)
    {
        OrderDetailsPo stores = orderDateEntity.save(orderDeta);
        return stores;
    }

    /**根据id删除商品**/
    public void  deleteOrderDetails(Integer id)
    {
        orderDateEntity.deleteById(id);
    }

    /**查询所有商品**/
    public List<OrderDetailsPo> findOrderDetails()
    {
        List<OrderDetailsPo> OrderDeta = (List<OrderDetailsPo>) orderDateEntity.findAll();
        return OrderDeta;
    }

    /**根据id查询商品**/
    public OrderDetailsPo findOrderDetailsId(Integer id)
    {
        OrderDetailsPo OrderDeta = orderDateEntity.getById(id);

        return OrderDeta;
    }


    /**修改状态付款**/
    public int UpOrderPay(Integer id)
    {
        int isT=  orderDateEntity.UpOrderpay(id);
        return isT;
    }

    /**修改发货状态**/
    public int UpOrderDetails(Integer id)
    {
        int isT=  orderDateEntity.UpOrderDetails(id);
        return isT;
    }

    /**查询相关数据**/
    public List<OrderDetailsPo> findOrder(Integer paymentStatus, Integer orderStatus,Integer deliverGoods)
    {
        List<OrderDetailsPo> OrderDeta = (List<OrderDetailsPo>) orderDateEntity.findOrderDetails(paymentStatus,orderStatus,deliverGoods);
        return OrderDeta;
    }


   public List<OrderDetailsPo> findOrderDetailsAndEmail(Integer paymentStatus, Integer orderStatus,Integer deliverGoods,String email)
    {
        List<OrderDetailsPo> OrderDeta = (List<OrderDetailsPo>) orderDateEntity.findOrderDetailsAndEmail(paymentStatus,orderStatus,deliverGoods,email);
        return OrderDeta;

    }





}
